package Extends.homeworkYuanZhu.com02;

import java.util.Scanner;

public class Student extends Person{
    private String no ;//学号
    private double scoreEn ; //英语成绩
    private double scoreMath ;//数学成绩
    private double scoreCh ;//语文成绩
    public Student() {
        super();     //关键字直接引用父类构造器
    }
    // .................................................分隔线
   //   new Scanner(System.in)
    //   Generate--->Getter and Setter   创建下面get和set的快捷键
    //  set 是用来收数据的  这样 student.setScoreEn(85);
    //  get 是用来输出数据  这样 System.out.println(student.getScoreCh());
    public String getNo() {
        return no;
    }
    public void setNo(String no) {
        this.no = no;
    }
    public double getScoreEn() {
        return scoreEn;
    }
    public void setScoreEn(double scoreEn) {
//        if (scoreEn <= 0 ) {
//            System.out.println("英语成绩错误，输入正确成绩");
//        else {}
        this.scoreEn = scoreEn; }
    public double getScoreMath() {
        return scoreMath;
    }
    public void setScoreMath(double scoreMath) {
        this.scoreMath = scoreMath;
    }
    public double getScoreCh() {
        return scoreCh;
    }
    public void setScoreCh(double scoreCh) {
        this.scoreCh = scoreCh;
    }
    //..........................................set/get分界线
    public double aver(){
        double f = (scoreCh+scoreEn+scoreMath)/3;
        return f;
    }//..........................................平均分
    public double max(){
       double m = Math.max(Math.max(scoreCh,scoreEn),scoreMath);
       return m ;
    }//....................................最高分
    public double min(){
        double n = Math.min(Math.min(scoreMath,scoreCh),scoreEn);
        return n ;
    }//.........................................最低分
    //..........................................
    @Override
    public String toString() {
        return
                "姓名：" + name + '\t' +
                "性别：" + sex + '\t' +
                "年龄：" + age+'\t'+
                "学号：" + no +'\n'+
                "英语成绩：" + scoreEn +'\t'+
                "数学成绩：" + scoreMath +'\t'+
                "语文成绩：" + scoreCh+'\n'+
                "平均分："+aver()+'\t'+
                "最高分："+max()+'\t'+
                "最低分："+min();
    }
}
